Generally, a network device may store a correspondence between a link-layer address and an Internet Protocol (IP) address by using a ternary content-addressable memory (TCAM). In consideration of disadvantages of the TCAM in terms of price and power consumption, many TCAMs are usually not deployed on the network device. Therefore, on the network device, space for storing the correspondence between a link-layer address and an IP address is limited.
As a network is continuously extended, a quantity of terminal devices that communicate with a network device is increased. In addition, a terminal device that supports the Internet Protocol version 6 (IPv6) may have one or more IPv6 addresses. Therefore, a problem that storage space of the network device is insufficient easily occurs.
At present, an aging mechanism is usually used to delete a correspondence, between a link-layer address and an IP address, that is stored in a network device and that is in an inactive state, so as to relieve a problem that cache space of the network device is insufficient. For example, a correspondence that is between a link-layer address and an IP address and that is not refreshed in a preset time period may be aged. However, the aging mechanism can only prevent a terminal device that already gets offline or a terminal device that has been inactive for a long time from occupying cache space of the network device for a long time, but the problem that storage space of the network device is insufficient cannot be effectively relieved.